package com.youxue.service;

import com.youxue.dao.OrderMapper;
import com.youxue.entity.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 15c on 2018/1/23.
 */
@Service("Order")
public class OrderServiceImpl implements OrderService {

    @Autowired
    OrderMapper orderMapper;
    @Override
    public int addOrder(Order order) {
        return orderMapper.insertSelective(order);
    }

    @Override
    public int payAOrder(Integer orderId) {
        return orderMapper.updateOrderStatus(orderId);
    }

    @Override
    public int reviseOrderStatus(Integer orderId) {
        return orderMapper.updateOrderStatusPlus(orderId);
    }

    @Override
    public int deleteOrder(Integer orderId) {
        return orderMapper.deleteByPrimaryKey(orderId);
    }

    @Override
    public List<Order> showAUserAllOrder(Integer userId, Integer orderStatus) {
        return orderMapper.selectAUserAllOrder(userId,orderStatus);
    }

    @Override
    public List<Order> showAUserAllOrders(Integer userId) {
        return orderMapper.selectAUserAllOrders(userId);
    }

    @Override
    public Order showAOldOrderInfo(Integer orderId) {
        return orderMapper.selectAOldOrderInfo(orderId);
    }

    @Override
    public Order showANowOrderInfo(Integer userId) {
        return orderMapper.selectANowOrderInfo(userId);
    }

    @Override
    public Order showAOrder(Integer userId, Integer classId) {
        return orderMapper.selectAOrder(userId,classId);
    }

    @Override
    public Order showAOrderInfo(Integer userId, Integer classId) {
        return orderMapper.selectAOrderInfo(userId,classId);
    }

    @Override
    public Order showAOrderNo(Integer userId, Integer classId) {
        return orderMapper.selectAOrderNo(userId,classId);
    }

    @Override
    public List<Order> showAUserBuyClass(Integer userId) {
        return orderMapper.selectAUserBuyClassByOrder(userId);
    }

    @Override
    public int payAOrderRollback(Integer orderId) {
        return orderMapper.updateAOrderRollback(orderId);
    }

    @Override
    public int reviseOrderClassCondition(Integer orderId) {
        return orderMapper.updateAOrderClassCondition(orderId);
    }

}
